﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Trends.TFC.Web.Controls;
using System.Web.UI.HtmlControls;

namespace DaCredito
{
    public partial class MessagePanel :  MessagePanelControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        public override void HideMessages()
        {
            this.divMessagePanel.Style.Add(HtmlTextWriterStyle.Display, "none");
        }

        public override void ShowMessages(TipoOperacao aoTipoOperacao)
        {
          
        }
        public override void ShowErrors()
        {

            if (this.isErrorList.Count > 0)
            {
                this.divErrorTitle.InnerText = "Falha!";
                this.divMessagePanel.Style.Add(HtmlTextWriterStyle.Display, "block");
                this.divMessagePanel.Attributes.Add("class", "error_div");
                foreach (string lsError in this.isErrorList)
                {
                    HtmlGenericControl li = new HtmlGenericControl("li");
                    li.Controls.Add(new LiteralControl(lsError));
                    this.ulMessagePanel.Controls.Add(li);
                }
            }
            else
                this.HideMessages();
        }
        public override void ShowSuccess()
        {

            if (this.isSucessList.Count > 0)
            {
                this.divErrorTitle.InnerText = "Sucesso!";
                
                this.divMessagePanel.Style.Add(HtmlTextWriterStyle.Display, "block");
                this.divMessagePanel.Attributes.Add("class", "success_div");
                foreach (string lsMessage in this.isSucessList)
                {
                    HtmlGenericControl li = new HtmlGenericControl("li");
                    li.Controls.Add(new LiteralControl(lsMessage));
                    this.ulMessagePanel.Controls.Add(li);
                }
            }
            else
                this.HideMessages();
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            //this.ShowErrors();
        }
    }
}